capture clear all
set more off
set mem 2000m
set matsize 11000
set maxvar 10000



use "Replication data main specifications", clear



**************
*Table 1

global mainspec  poststdint  provinceyearfixed* countyfixed*  license_std tariff_std  veryhighpost ntr_rate_std mfa_std soefixed* int_* [aw=total_emp_c_90], cl(countycode) partial(countyfixed* provinceyearfixed*)


qui ivreg2 log_exports $mainspec
est2vec gdpresults, vars(poststdint veryhighpost   mfa_std  tariff_std  license_std  ntr_rate_std )  na(Col1) e(N F) replace
qui ivreg2 log_primary $mainspec
est2vec gdpresults, addto(gdpresults) na(Col6)
qui ivreg2 log_secondary $mainspec
est2vec gdpresults, addto(gdpresults) na(Col2)
qui ivreg2 log_tertiary $mainspec
est2vec gdpresults, addto(gdpresults) na(Col3)
qui ivreg2 log_gdp $mainspec
est2vec gdpresults, addto(gdpresults) na(Col4)
qui ivreg2 log_gdp_pc_alt $mainspec
est2vec gdpresults, addto(gdpresults) na(Col5)
matrix rownames gdpresults_b=Post~x~NTR~gap Post~x~Contract  MFA  Tariff  License  NTR~rate 
est2tex gdpresults, replace preserve path("Replication") mark(stars) levels(90 95 99) fancy collabels("Exports" "Primary" "Secondary" "Tertiary" "GDP" "Per~capita~GDP")


qui ivreg2 log_prim_emp_full $mainspec
est2vec empresults, vars(poststdint  veryhighpost  mfa_std  tariff_std  license_std  ntr_rate_std )  na(Col1) e(N F) replace
qui ivreg2 log_ag_emp $mainspec
est2vec empresults, addto(empresults) na(Col4)
qui ivreg2 log_second_emp_full $mainspec
est2vec empresults, addto(empresults) na(Col2)
qui ivreg2 log_tert_emp_full $mainspec
est2vec empresults, addto(empresults) na(Col3)
qui ivreg2 log_total_emp $mainspec
est2vec empresults, addto(empresults) na(Col5)
qui ivreg2 log_total_pop $mainspec
est2vec empresults, addto(empresults) na(Col6)
matrix rownames empresults_b=Post~x~NTR~gap Post~x~Contract  MFA  Tariff  License  NTR~rate 
est2tex empresults, replace preserve path("Replication") mark(stars) levels(90 95 99) fancy collabels("Primary"  "Agri." "Secondary" "Tertiary" "Total~emp." "Total~pop.")



qui ivreg2 log_sownarea $mainspec
est2vec agriresults, vars(poststdint  veryhighpost   mfa_std  tariff_std  license_std  ntr_rate_std )   na(Col1) e(N F) replace
qui ivreg2 log_agrimachine $mainspec
est2vec agriresults, addto(agriresults) na(Col2)
qui ivreg2 log_grain $mainspec
est2vec agriresults, addto(agriresults) na(Col3)
qui ivreg2 log_cash $mainspec
est2vec agriresults, addto(agriresults) na(Col4)
qui ivreg2 log_grainyield $mainspec
est2vec agriresults, addto(agriresults) na(Col5)
matrix rownames agriresults_b=Post~x~NTR~gap Post~x~Contract  MFA  Tariff  License  NTR~rate 
est2tex agriresults, replace preserve path("Replication") mark(stars) levels(90 95 99) fancy collabels("Sown~area" "Agri.~machine" "Grain" "Cash" "Grain~yield")

*********************
*Table 2

*Panel A

global mainspec  poststdint  provinceyearfixed* countyfixed*  license_std tariff_std  veryhighpost ntr_rate_std mfa_std int_*  if log_exports!=. [aw=total_emp_c_90], cl(countycode) partial(countyfixed* provinceyearfixed*)

qui ivreg2 log_exports $mainspec
est2vec gdpresults_limsample, vars(poststdint poststdint_city veryhighpost veryhighpost_city mfa_std mfa_std_city tariff_std tariff_city license_std license_city ntr_rate_std ntr_rate_std_city)  na(Col1) e(N F) replace
qui ivreg2 log_primary $mainspec
est2vec gdpresults_limsample, addto(gdpresults_limsample) na(Col6)
qui ivreg2 log_secondary $mainspec
est2vec gdpresults_limsample, addto(gdpresults_limsample) na(Col2)
qui ivreg2 log_tertiary $mainspec
est2vec gdpresults_limsample, addto(gdpresults_limsample) na(Col3)
qui ivreg2 log_gdp $mainspec
est2vec gdpresults_limsample, addto(gdpresults_limsample) na(Col4)
qui ivreg2 log_gdp_pc_alt $mainspec
est2vec gdpresults_limsample, addto(gdpresults_limsample) na(Col5)
matrix rownames gdpresults_limsample_b=Post~x~NTR~gap 
est2tex gdpresults_limsample, replace preserve path("Replication") mark(stars) levels(90 95 99) fancy collabels("Exports" "Primary" "Secondary" "Tertiary" "GDP" "Per~capita~GDP")


*Panel B


global mainspec  poststdint  provinceyearfixed* countyfixed*  license_std tariff_std  veryhighpost ntr_rate_std mfa_std int_* soefixed* [aw=total_emp_c_90], cl(countycode) partial(countyfixed* provinceyearfixed*)


qui ivreg2 log_exports_restrict $mainspec
est2vec gdpresults_sampleselect, vars(poststdint poststdint_city veryhighpost veryhighpost_city mfa_std mfa_std_city tariff_std tariff_city license_std license_city ntr_rate_std ntr_rate_std_city)  na(Col1) e(N F) replace
qui ivreg2 log_primary_restrict $mainspec
est2vec gdpresults_sampleselect, addto(gdpresults_sampleselect) na(Col6)
qui ivreg2 log_secondary_restrict $mainspec
est2vec gdpresults_sampleselect, addto(gdpresults_sampleselect) na(Col2)
qui ivreg2 log_tertiary_restrict $mainspec
est2vec gdpresults_sampleselect, addto(gdpresults_sampleselect) na(Col3)
qui ivreg2 log_gdp_restrict $mainspec
est2vec gdpresults_sampleselect, addto(gdpresults_sampleselect) na(Col4)
qui ivreg2 log_gdp_pc_alt_restrict $mainspec
est2vec gdpresults_sampleselect, addto(gdpresults_sampleselect) na(Col5)
matrix rownames gdpresults_sampleselect_b=Post~x~NTR~gap 
est2tex gdpresults_sampleselect, replace preserve path("Replication") mark(stars) levels(90 95 99) fancy collabels("Exports" "Primary" "Secondary" "Tertiary" "GDP" "Per~capita~GDP")


*Panel C

global mainspec  poststdint  provinceyearfixed* countyfixed*  license_std tariff_std  veryhighpost ntr_rate_std mfa_std int_* obsfixed* [aw=total_emp_c_90], cl(countycode) partial(countyfixed* provinceyearfixed*)


xtile obsquant=obs_exports, nq(2)
foreach x of numlist 1/4 {
foreach y of numlist 1994/2013 {
gen obsfixed_`x'_`y'=0
replace obsfixed_`x'_`y'=1 if obsquant==`x' & year==`y'
}
}

qui ivreg2 log_exports $mainspec
est2vec gdpresults_obsfixed, vars(poststdint) na(Col1) e(N F) replace

drop obsquant obsfixed*
xtile obsquant=obs_primary, nq(2)
foreach x of numlist 1/4 {
foreach y of numlist 1994/2013 {
gen obsfixed_`x'_`y'=0
replace obsfixed_`x'_`y'=1 if obsquant==`x' & year==`y'
}
}

qui ivreg2 log_primary $mainspec
est2vec gdpresults_obsfixed, addto(gdpresults_obsfixed) na(Col6)

drop obsquant obsfixed*
xtile obsquant=obs_secondary, nq(2)
foreach x of numlist 1/4 {
foreach y of numlist 1994/2013 {
gen obsfixed_`x'_`y'=0
replace obsfixed_`x'_`y'=1 if obsquant==`x' & year==`y'
}
}

qui ivreg2 log_secondary $mainspec
est2vec gdpresults_obsfixed, addto(gdpresults_obsfixed) na(Col2)

drop obsquant obsfixed*
xtile obsquant=obs_tertiary, nq(2)
foreach x of numlist 1/4 {
foreach y of numlist 1994/2013 {
gen obsfixed_`x'_`y'=0
replace obsfixed_`x'_`y'=1 if obsquant==`x' & year==`y'
}
}

qui ivreg2 log_tertiary $mainspec
est2vec gdpresults_obsfixed, addto(gdpresults_obsfixed) na(Col3)

drop obsquant obsfixed*
xtile obsquant=obs_gdp, nq(2)
foreach x of numlist 1/4 {
foreach y of numlist 1994/2013 {
gen obsfixed_`x'_`y'=0
replace obsfixed_`x'_`y'=1 if obsquant==`x' & year==`y'
}
}

qui ivreg2 log_gdp $mainspec
est2vec gdpresults_obsfixed, addto(gdpresults_obsfixed) na(Col4)

drop obsquant obsfixed*
xtile obsquant=obs_gdp_pc_alt, nq(2)
foreach x of numlist 1/4 {
foreach y of numlist 1994/2013 {
gen obsfixed_`x'_`y'=0
replace obsfixed_`x'_`y'=1 if obsquant==`x' & year==`y'
}
}

qui ivreg2 log_gdp_pc_alt $mainspec
est2vec gdpresults_obsfixed, addto(gdpresults_obsfixed) na(Col5)
matrix rownames gdpresults_obsfixed_b=Post~x~NTR~gap
est2tex gdpresults_obsfixed, replace preserve path("Replication") mark(stars) levels(90 95 99) fancy collabels("Exports" "Primary" "Secondary" "Tertiary" "GDP" "Per~capita~GDP")



*********************
*Table 3


*Panel A

global mainspec  post2000int_std provinceyearfixed* countyfixed*  license_std tariff_std  veryhighpost ntr_rate_std mfa_std int_* [aw=total_emp_c_90], cl(countycode) partial(countyfixed* provinceyearfixed*)



qui ivreg2 log_exports $mainspec
est2vec gdpresults_2000weights, vars(post2000int_std)  na(Col1) e(N F) replace
qui ivreg2 log_primary $mainspec
est2vec gdpresults_2000weights, addto(gdpresults_2000weights) na(Col6)
qui ivreg2 log_secondary $mainspec
est2vec gdpresults_2000weights, addto(gdpresults_2000weights) na(Col2)
qui ivreg2 log_tertiary $mainspec
est2vec gdpresults_2000weights, addto(gdpresults_2000weights) na(Col3)
qui ivreg2 log_gdp $mainspec
est2vec gdpresults_2000weights, addto(gdpresults_2000weights) na(Col4)
qui ivreg2 log_gdp_pc_alt $mainspec
est2vec gdpresults_2000weights, addto(gdpresults_2000weights) na(Col5)
matrix rownames gdpresults_2000weights_b=Post~x~NTR~gap 
est2tex gdpresults_2000weights, replace preserve path("Replication") mark(stars) levels(90 95 99) fancy collabels("log_exports" "log_primary" "log_secondary" "log_tertiary" "log_gdp" "Per~capita~log_gdp")


*Panel B



global mainspec  postnontradeableint_std  provinceyearfixed* countyfixed*  license_std tariff_std ntr_rate_std  int_* tertint_*  [aw=total_emp_c_90], cl(countycode) partial(countyfixed* provinceyearfixed*)


qui ivreg2 log_exports $mainspec
est2vec gdpresults_nontrade, vars(postnontradeableint_std)  na(Col1) e(N F) replace
qui ivreg2 log_primary $mainspec
est2vec gdpresults_nontrade, addto(gdpresults_nontrade) na(Col6)
qui ivreg2 log_secondary $mainspec
est2vec gdpresults_nontrade, addto(gdpresults_nontrade) na(Col2)
qui ivreg2 log_tertiary $mainspec
est2vec gdpresults_nontrade, addto(gdpresults_nontrade) na(Col3)
qui ivreg2 log_gdp $mainspec
est2vec gdpresults_nontrade, addto(gdpresults_nontrade) na(Col4)
qui ivreg2 log_gdp_pc_alt $mainspec
est2vec gdpresults_nontrade, addto(gdpresults_nontrade) na(Col5)
matrix rownames gdpresults_nontrade_b=Post~x~NTR~gap 
est2tex gdpresults_nontrade, replace preserve path("Replication") mark(stars) levels(90 95 99) fancy collabels("log_exports" "log_primary" "log_secondary" "log_tertiary" "log_gdp" "Per~capita~log_gdp")




*Panel C

global mainspec poststdint primchange1_post secondchange1_post countyfixed* provinceyearfixed* int_*  mfa_std  license_std  tariff_std  veryhighpost  ntr_rate_std [aw=total_emp_c_90], cl(countycode) partial(countyfixed* provinceyearfixed*)


qui ivreg2 log_exports $mainspec
est2vec gdpresults_trendcorrection, vars(poststdint veryhighpost  mfa_std  tariff_std  license_std  ntr_rate_std )  na(Col1) e(N F) replace
qui ivreg2 log_primary $mainspec
est2vec gdpresults_trendcorrection, addto(gdpresults_trendcorrection) na(Col6)
qui ivreg2 log_secondary $mainspec
est2vec gdpresults_trendcorrection, addto(gdpresults_trendcorrection) na(Col2)
qui ivreg2 log_tertiary $mainspec
est2vec gdpresults_trendcorrection, addto(gdpresults_trendcorrection) na(Col3)
qui ivreg2 log_gdp $mainspec
est2vec gdpresults_trendcorrection, addto(gdpresults_trendcorrection) na(Col4)
qui ivreg2 log_gdp_pc_alt $mainspec
est2vec gdpresults_trendcorrection, addto(gdpresults_trendcorrection) na(Col5)
matrix rownames gdpresults_trendcorrection_b=Post~x~NTR~gap Post~x~Contract  MFA  Tariff  License  NTR~rate 
est2tex gdpresults_trendcorrection, replace preserve path("Replication") mark(stars) levels(90 95 99) fancy collabels("Exports" "Primary" "Secondary" "Tertiary" "Gdp" "Per~capita~gdp")




*Table 5 Panel B




global mainspec placebo_hightariff_std tariffdecilequant* provinceyearfixed* countyfixed* int_*  mfa_std  license_std  tariff_std  veryhighpost  ntr_rate_std  [aw=total_emp_c_90], cl(countycode) partial(tariffdecilequant* provinceyearfixed* countyfixed* int_*)


ivreg2 log_exports $mainspec
est2vec gdpresults_placebopost, vars(placebo_hightariff_std)  na(Col1) e(N F) replace
ivreg2 log_primary $mainspec
est2vec gdpresults_placebopost, addto(gdpresults_placebopost) na(Col2)
ivreg2 log_secondary $mainspec
est2vec gdpresults_placebopost, addto(gdpresults_placebopost) na(Col3)
ivreg2 log_tertiary $mainspec
est2vec gdpresults_placebopost, addto(gdpresults_placebopost) na(Col4)
ivreg2 log_gdp $mainspec
est2vec gdpresults_placebopost, addto(gdpresults_placebopost) na(Col5)
ivreg2 log_gdp_pc_alt $mainspec
est2vec gdpresults_placebopost, addto(gdpresults_placebopost) na(Col6)
est2tex gdpresults_placebopost, replace preserve path("Replication") mark(stars) levels(90 95 99) fancy collabels("Exports" "Primary" "Secondary" "Tertiary" "Gdp" "Per~capita~gdp")

